package test.org.lvxiao.example.spring;

import org.aopalliance.aop.Advice;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.ClassFilter;
import org.springframework.aop.IntroductionAdvisor;
import org.springframework.aop.support.annotation.AnnotationClassFilter;
import org.springframework.stereotype.Component;

@Component
public class IntroductionAdvisorImpl implements IntroductionAdvisor, MethodInterceptor {

	@Override
	public Advice getAdvice() {
		return new IntroductionAdvisorImpl();
	}

	@Override
	public boolean isPerInstance() {
		return false;
	}

	@Override
	public Class<?>[] getInterfaces() {
		return new Class<?>[] {};
	}

	@Override
	public ClassFilter getClassFilter() {
		return new AnnotationClassFilter(APOTest.class);
	}

	@Override
	public void validateInterfaces() throws IllegalArgumentException {

	}

	@Override
	public Object invoke(MethodInvocation invocation) throws Throwable {
		
		System.out.println("------");
		return invocation.proceed();
	}

}
